<?php
include "header.php";

require_once "./libs/page.php";

$sql_cnt="select id  from wish";
$result = $conn->query($sql_cnt);
$total_cnt = $result->num_rows;

$listRows = 2;

// 生成分页条
 
$params = array(

            'total_rows'=>$toatal_cnt, #(必须)            
            'now_page'  =>$_GET['p'] ? $_GET['p'] : 1,  #(必须)
            'list_rows' =>$listRows, #(可选) 默认为15
);
$Page = new Pagegation($params);
// end 

// 取得本页的记录

$sql = $sql_cnt." limit ".$Page->first_row.','.$Page->list_rows;

$result = $conn->query($sql);
$arrlist = array();

if ($result->num_rows > 0) {  
    // 输出每行数据

    while($row = $result->fetch_assoc()) {

        array_push($arrlist, $row);        
    }
} 
$result->free();
$conn->close(); 
?>

<div id="right">
	style>
	#right table, #page {
		margin-top:20px;
		margin-left: 5px;
                width: 800px;
               
	}
</style>

<table border="1">
<tr>
<td>序号</td>
<td>留言者</td>
<td>留言内容</td>
<td>留言时间</td>
<td>操作</td>
</tr>
<?php foreach($arrlist as $vo){ ?>
<tr>
<td><?php echo $vo['id'];?></td>
<td><?php echo $vo['username'];?></td>
<td><?php echo $vo['content'];?></td>
<td><?php echo $vo['time_at'];?></td>
<td><span><a>修改</a></span>   
</tr<span><a>删除</a></span></td>
<tr/>
<?php } ?>
</table>
    <div id="page">
     <?php echo $Page->show(1);?>
    </div>
<div style="clear:both;">
    
</div>
<?php include"footer.php";?>